package com.door.erp.dao.hibernate;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.door.erp.dao.PurchaseOrderDao;
import com.door.erp.dao.base.GenericDaoImpl;
import com.door.erp.model.PurchaseOrder;

@Repository(value="purchaseOrderDao")
public class PurchaseOrderDaoImpl extends GenericDaoImpl<PurchaseOrder, Long>
		implements PurchaseOrderDao {

	@Override
	protected Class<PurchaseOrder> getPersistentClass() {
		return PurchaseOrder.class;
	}
	
	public List<PurchaseOrder> getPurchaseOrdersByTime(Date beginTime,
			Date endTime) {
		String hql = "from PurchaseOrder where createTime between ? and ? order by createTime desc";
		return this.getAll(hql, beginTime, endTime);
	}

}
